import lejos.nxt.Button;
import lejos.robotics.subsumption.Behavior;

/**
 * Highest priority class to be able to turn off the robot. Also tells
 * BillManager to load the live data.
 * 
 * @see BillManager
 */
public class Exit implements Behavior {
	private boolean suppressed = false;

	/**
	 * Shutdown.
	 */
	public void action() {
		suppressed = false;
		System.exit(0);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see lejos.robotics.subsumption.Behavior#suppress()
	 */
	public void suppress() {
		suppressed = true;
	}

	/**
	 * Only take control if the ESCAPE button is pressed.
	 */
	public boolean takeControl() {
		BillManager.LoadLiveData();
		return Button.ESCAPE.isPressed();
	}
}
